<script type="text/javascript" src="static/plugins/ajaxFileUpload/ajaxfileupload.js"></script>


<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',border:false">
		<form id="cmsConfigForm" action="cmsConfig.do?saveCmsConfig" enctype="multipart/form-data">
			<table cellpadding="5">
				<input name="id" type="hidden" value="${(cmsConfigItem.id)!}" />
<!-- 				<tr> -->
<!-- 					<td class="tbLabel">编码:</td> -->
<!-- 					<td> -->
<!-- 						<input name="code"  class="easyui-validatebox textbox" data-options="required: false" value="${(cmsConfigItem.code)!}"/> -->
<!-- 					</td> -->
<!-- 				</tr> -->
				<tr>
					<td class="tbLabel">网站名称:</td>
					<td>
						<input name="name"  class="easyui-validatebox textbox" style="width:650px;" data-options="required: true" value="${(cmsConfigItem.name)!}"/>
					</td>
				</tr>
				<tr>
					<td class="tbLabel">LOGO图片:</td>
					<td>
						<img src="static/cms/www/default/images/logo.png" width="600"/>
<!-- 						<input type="file" class="easyui-filebox" /> -->
<!-- 						<button class="button" id="buttonUpload" onclick="return ajaxFileUpload();">上传</button> -->
<!--                    		<input name="logoUrl" class="easyui-validatebox" type="hidden"> -->
<!-- 						<input name="logoUrl"  class="easyui-validatebox textbox" data-options="required: false" value="${(cmsConfigItem.logoUrl)!}"/> -->
					</td>
				</tr>
<!-- 				<tr> -->
<!-- 					<td class="tbLabel">电话:</td> -->
<!-- 					<td> -->
<!-- 						<input name="tel"  class="easyui-validatebox textbox" data-options="required: false" value="${(cmsConfigItem.tel)!}"/> -->
<!-- 					</td> -->
<!-- 				</tr> -->
<!-- 				<tr> -->
<!-- 					<td class="tbLabel">传真:</td> -->
<!-- 					<td> -->
<!-- 						<input name="fax"  class="easyui-validatebox textbox" data-options="required: false" value="${(cmsConfigItem.fax)!}"/> -->
<!-- 					</td> -->
<!-- 				</tr> -->
<!-- 				<tr> -->
<!-- 					<td class="tbLabel">ICP备案号:</td> -->
<!-- 					<td> -->
<!-- 						<input name="icpNum"  class="easyui-validatebox textbox" data-options="required: false" value="${(cmsConfigItem.icpNum)!}"/> -->
<!-- 					</td> -->
<!-- 				</tr> -->
				<tr>
					<td class="tbLabel">主办方单位:</td>
					<td>
						<input name="hostInfo"  class="easyui-validatebox textbox" data-options="required: false" style="width:650px;" value="${(cmsConfigItem.hostInfo)!}"/>
					</td>
				</tr>
				
				<tr>
					<td class="tbLabel">主办方地址:</td>
					<td>
						<input name="hostAddr"  class="easyui-validatebox textbox" data-options="required: true" style="width:650px;" value="${(cmsConfigItem.hostAddr)!}"/>
					</td>
				</tr>
				
				<tr>
					<td class="tbLabel">版权描述:</td>
					<td>
						<input name="copyright"  class="easyui-validatebox textbox" data-options="required: true" style="width:650px;" value="${(cmsConfigItem.copyright)!}"/>
					</td>
				</tr>
				<!--  
				<tr>
					<td class="tbLabel">首页显示广告栏:</td>
					<td>
						<@eu.comboBox name="linkAd" url="common.do?loadComboBox&key=YON&value=${(cmsConfigItem.linkAd)!'false'}" />
					</td>
				</tr>
				-->
			</table>
		</form>
	</div>
	<div data-options="region:'south',border:false">
		<div style="padding:3px 0;border-top:1px solid #95B8E7;text-align: center;">		
			<@eu.linkbutton showName="保存" shiro="cms:cmsConfig:save" iconCls="icon-edit" style="border:1px solid #bbb;background: #eaf2ff;" onclick="saveOrUpdateCmsConfig()"/>
	    </div>
	</div>
</div>
<script type="text/javascript">
function saveOrUpdateCmsConfig() {
	var validate = $('#cmsConfigForm').form("validate");
	if(validate) {
		var actionurl = $('#cmsConfigForm').attr('action');//提交路径
		var formData = new Object();

		var fields = $('#cmsConfigForm').serializeArray(); //自动序列化表单元素为JSON对象  

		$.each(fields, function(i, field) {
			formData[field.name] = field.value;
		});
		$.ajax({
			async : false,
			cache : false,
			type : 'POST',
			url : actionurl,// 请求的action路径
			data : formData,
			error : function() {// 请求失败处理函数
				showMsg('保存失败.');
			},
			success : function(data) {
				showMsg('保存成功.');
			}
		});
	}
	
}


function ajaxFileUpload(){
    $("#loading")
    .ajaxStart(function(){
        $(this).show();
    })
    .ajaxComplete(function(){
        $(this).hide();
    });

    $.ajaxFileUpload
    (
        {
            url:'common.do?uploadFile',
            secureuri:false,
            fileElementId:'filedata',
            dataType: 'json',
            data:{name:'logan', id:'id'},
            success: function (data, status)
            {
                if(typeof(data.error) != 'undefined')
                {
                    if(data.error != '')
                    {
                        alert(data.error);
                    }else{    
                        alert("上传成功")
                        $("#imgURL").attr("value",data.msg);
                        //alert(data.msg);
                        //$("#img").attr("src","upload/"+data.msg);
                        
                    }
                }
            },
            error: function (data, status, e)
            {
                alert(e);
            }
        }
    )

    return false;

}
</script>
